<%@page contentType="text/html; charset=UTF-8" import="com.pub.database.*,java.util.*" %>
<jsp:useBean id="DataViewForm" scope="request" class="com.pub.database.DataViewForm"/>
<!-- 以下為DataView 共用設定 -->
<jsp:setProperty name="DataViewForm" property="submitMethod" value="POST"/>
<jsp:setProperty name="DataViewForm" property="pageRowCount" value="10"/>
<jsp:setProperty name="DataViewForm" property="nowPageNum"/>
<jsp:setProperty name="DataViewForm" property="dataViewAction"/>
<jsp:setProperty name="DataViewForm" property="filterCol"/>
<jsp:setProperty name="DataViewForm" property="filterValue"/>
<jsp:setProperty name="DataViewForm" property="dvOrderByFields"/>
<jsp:setProperty name="DataViewForm" property="dvOrderBySeq"/>
<!-- DataView 設定結束 -->
<%
        QueryBean gqbnDAO = new QueryBean("PIS1_SWD",
                                          true,
                                          ResourceBundle.getBundle("WEB_Config").getString("SOURCE_CHARSET"),
                                          ResourceBundle.getBundle("WEB_Config").getString("TARGET_CHARSET"));

        DataView dataView=null;

        dataView = new DataView(gqbnDAO);

       StringBuffer stbCondition = new StringBuffer();
       StringBuffer stbPageActionURI = new StringBuffer("testNewDataView.jsp?prgAction=");

       DataViewForm.setTablesList(" wkf_frm1 ");

       stbCondition.append(" prg_no='");
       stbCondition.append("pas6_1_add");
       stbCondition.append("' and frm_no='");
       stbCondition.append("1");
       stbCondition.append("'");

       DataViewForm.setSQLCondition(stbCondition.toString());
       DataViewForm.setOrderByFields("seqno");
       DataViewForm.setOrderBySeq("asc");
       DataViewForm.setGroupBy(null);
       DataViewForm.setHaving(null);

       //Hashtable lhtColRelation=new Hashtable();
       ArrayList laltColRelation=new ArrayList();
       Hashtable lhtColRelationDetail=new Hashtable();

       lhtColRelationDetail.put(dataView.STR_FIELD_NAME,"SEQNO");
       lhtColRelationDetail.put(dataView.STR_FIELD_TITLE,"'欄序'");
       lhtColRelationDetail.put(dataView.STR_FIELD_KIND,"0");
       lhtColRelationDetail.put(dataView.STR_FIELD_PROPERTY,"rowSpan='3' width='3%' align='center'");
       lhtColRelationDetail.put(dataView.STR_FIELD_APPEND_ROW_HTML,"　");//使用全形空白
       lhtColRelationDetail.put(dataView.STR_FIELD_VALUE,"SEQNO");

       laltColRelation.add(new Hashtable(lhtColRelationDetail));
       lhtColRelationDetail.clear();

       lhtColRelationDetail.put(dataView.STR_FIELD_NAME,"RW_MODE");
       lhtColRelationDetail.put(dataView.STR_FIELD_TITLE,"'編輯方式'");
       lhtColRelationDetail.put(dataView.STR_FIELD_KIND,"SELECT");
       lhtColRelationDetail.put(dataView.STR_FIELD_PROPERTY,"WIDTH='10%' align='middle'");
       lhtColRelationDetail.put(dataView.STR_FIELD_HTML,"<SELECT class='input' NAME=\"rw_mode\">");
       lhtColRelationDetail.put(dataView.STR_FIELD_VALUE,"<option value=\"H\">HIDDEN</option>,<option value=\"F\">FILE</option>,<option value=\"T\">TEXT BOX</option>,<option value=\"B\">BUTTON</option>,<option value=\"C\">CHECK BOX</option>,<option value=\"R\">RADIO BUTTON</option>,<option value=\"L\">LINK</option>,<option value=\"E\">RESET</option>,<option value=\"S\">SUBMIT</option>,<option value=\"A\">NOTE LINE</option>,<option value=\"D\">DROP-DOWN</option>,<option value=\"M\">TEXTAREA</option>,<option value=\"N\">RICHTEXT</option>,<option value=\"V\">SHOW</option>");
       lhtColRelationDetail.put(dataView.STR_FIELD_APPEND_ROW_HTML,"<SELECT class='input' NAME='rw_mode'><option value='H'>HIDDEN</option><option value='F'>FILE</option><option value='T'>TEXT BOX</option><option value='B'>BUTTON</option><option value='C'>CHECK BOX</option><option value='R'>RADIO BUTTON</option><option value='L'>LINK</option><option value='E'>RESET</option><option value='S'>SUBMIT</option><option value='A'>NOTE LINE</option><option value='D'>DROP-DOWN</option><option value='M'>TEXTAREA</option><option value='N'>RICHTEXT</option><option value='V'>SHOW</option></select></select>");

       laltColRelation.add(new Hashtable(lhtColRelationDetail));
       lhtColRelationDetail.clear();

       lhtColRelationDetail.put(dataView.STR_FIELD_NAME,"LINK_FLD");
       lhtColRelationDetail.put(dataView.STR_FIELD_TITLE,"'串主檔欄'");
       lhtColRelationDetail.put(dataView.STR_FIELD_KIND,"INPUT");
       lhtColRelationDetail.put(dataView.STR_FIELD_PROPERTY,"WIDTH='10%' align='center'");
       lhtColRelationDetail.put(dataView.STR_FIELD_HTML,"<input type='text' size='20' maxlength='40' name='link_fld' value=");
       lhtColRelationDetail.put(dataView.STR_FIELD_APPEND_ROW_HTML,"<input type='text' size='20' maxlength='40' name='link_fld' value='LINK_FLD'/>");
       lhtColRelationDetail.put(dataView.STR_FIELD_VALUE,"LINK_FLD");

       laltColRelation.add(new Hashtable(lhtColRelationDetail));
       lhtColRelationDetail.clear();

       lhtColRelationDetail.put(dataView.STR_FIELD_NAME,"FLD_KIND");
       lhtColRelationDetail.put(dataView.STR_FIELD_TITLE,"'資料型態'");
       lhtColRelationDetail.put(dataView.STR_FIELD_KIND,"INPUT");
       lhtColRelationDetail.put(dataView.STR_FIELD_PROPERTY,"WIDTH='10%' align='center'");
       lhtColRelationDetail.put(dataView.STR_FIELD_HTML,"<input type='text' size='20' maxlength='40' name='fld_kind' value=");
       lhtColRelationDetail.put(dataView.STR_FIELD_APPEND_ROW_HTML,"<input type='text' size='20' maxlength='40' name='fld_kind' value='FLD_KIND'/>");
       lhtColRelationDetail.put(dataView.STR_FIELD_VALUE,"FLD_KIND");

       laltColRelation.add(new Hashtable(lhtColRelationDetail));
       lhtColRelationDetail.clear();

       lhtColRelationDetail.put(dataView.STR_FIELD_NAME,"FLD_LEN");
       lhtColRelationDetail.put(dataView.STR_FIELD_TITLE,"'長度'");
       lhtColRelationDetail.put(dataView.STR_FIELD_KIND,"INPUT");
       lhtColRelationDetail.put(dataView.STR_FIELD_PROPERTY,"WIDTH='10%' align='center'");
       lhtColRelationDetail.put(dataView.STR_FIELD_HTML,"<input type='text' size='20' maxlength='40' name='fld_len' value=");
       lhtColRelationDetail.put(dataView.STR_FIELD_APPEND_ROW_HTML,"<input type='text' size='20' maxlength='40' name='fld_len' value='FLD_LEN'/>");
       lhtColRelationDetail.put(dataView.STR_FIELD_VALUE,"FLD_LEN");

       laltColRelation.add(new Hashtable(lhtColRelationDetail));
       lhtColRelationDetail.clear();

       lhtColRelationDetail.put(dataView.STR_FIELD_NAME,"FLD_MAX_LEN");
       lhtColRelationDetail.put(dataView.STR_FIELD_TITLE,"'限'");
       lhtColRelationDetail.put(dataView.STR_FIELD_KIND,"INPUT");
       lhtColRelationDetail.put(dataView.STR_FIELD_PROPERTY,"WIDTH='10%' align='center'");
       lhtColRelationDetail.put(dataView.STR_FIELD_HTML,"<input type='text' size='20' maxlength='40' name='fld_max_len' value=");
       lhtColRelationDetail.put(dataView.STR_FIELD_APPEND_ROW_HTML,"<input type='text' size='20' maxlength='40' name='fld_max_len' value='FLD_MAX_LEN'/>");
       lhtColRelationDetail.put(dataView.STR_FIELD_VALUE,"FLD_MAX_LEN");

       laltColRelation.add(new Hashtable(lhtColRelationDetail));
       lhtColRelationDetail.clear();

       lhtColRelationDetail.put(dataView.STR_FIELD_NAME,"NOT_NULL_YN");
       lhtColRelationDetail.put(dataView.STR_FIELD_TITLE,"'欄位必填'");
       lhtColRelationDetail.put(dataView.STR_FIELD_KIND,"RADIO");
       lhtColRelationDetail.put(dataView.STR_FIELD_PROPERTY,"WIDTH='10%' align='center'");
       lhtColRelationDetail.put(dataView.STR_FIELD_HTML,"<input type='radio' name='not_null_yn' value='Y'");
       lhtColRelationDetail.put(dataView.STR_FIELD_APPEND_ROW_HTML,"<input type='text' size='20' maxlength='40' name='not_null_yn' value='Y'/>");
       lhtColRelationDetail.put(dataView.STR_FIELD_VALUE,"NOT_NULL_YN");

       laltColRelation.add(new Hashtable(lhtColRelationDetail));
       lhtColRelationDetail.clear();

       lhtColRelationDetail.put(dataView.STR_FIELD_NAME,"NOT_NULL_CNDT");
       lhtColRelationDetail.put(dataView.STR_FIELD_TITLE,"'欄位必填條件'");
       lhtColRelationDetail.put(dataView.STR_FIELD_KIND,"INPUT");
       lhtColRelationDetail.put(dataView.STR_FIELD_PROPERTY,"WIDTH='10%' align='center'");
       lhtColRelationDetail.put(dataView.STR_FIELD_HTML,"<input type='text' size='20' maxlength='40' name='not_null_cndt' value=");
       lhtColRelationDetail.put(dataView.STR_FIELD_APPEND_ROW_HTML,"<input type='text' size='20' maxlength='40' name='not_null_cndt' value='NOT_NULL_CNDT'/>");
       lhtColRelationDetail.put(dataView.STR_FIELD_VALUE,"NOT_NULL_CNDT");
       lhtColRelationDetail.put(dataView.STR_FIELD_LINE_FEED,"true");

       laltColRelation.add(new Hashtable(lhtColRelationDetail));
       lhtColRelationDetail.clear();

       lhtColRelationDetail.put(dataView.STR_FIELD_NAME,"FLD_NO");
       lhtColRelationDetail.put(dataView.STR_FIELD_TITLE,"'欄位名稱'");
       lhtColRelationDetail.put(dataView.STR_FIELD_KIND,"INPUT");
       lhtColRelationDetail.put(dataView.STR_FIELD_PROPERTY,"WIDTH='10%' align='center'");
       lhtColRelationDetail.put(dataView.STR_FIELD_HTML,"<input type='text' size='20' maxlength='40' name='fld_no' value=");
       lhtColRelationDetail.put(dataView.STR_FIELD_APPEND_ROW_HTML,"<input type='text' size='20' maxlength='40' name='fld_no' value='FLD_NO'/>");
       lhtColRelationDetail.put(dataView.STR_FIELD_VALUE,"FLD_NO");

       laltColRelation.add(new Hashtable(lhtColRelationDetail));
       lhtColRelationDetail.clear();

       lhtColRelationDetail.put(dataView.STR_FIELD_NAME,"LINK_KIND");
       lhtColRelationDetail.put(dataView.STR_FIELD_TITLE,"'連動動作'");
       lhtColRelationDetail.put(dataView.STR_FIELD_KIND,"INPUT");
       lhtColRelationDetail.put(dataView.STR_FIELD_PROPERTY,"WIDTH='10%' align='center'");
       lhtColRelationDetail.put(dataView.STR_FIELD_HTML,"<input type='text' size='20' maxlength='40' name='link_kind' value=");
       lhtColRelationDetail.put(dataView.STR_FIELD_APPEND_ROW_HTML,"<input type='text' size='20' maxlength='40' name='link_kind' value='LINK_KIND'/>");
       lhtColRelationDetail.put(dataView.STR_FIELD_VALUE,"LINK_KIND");

       laltColRelation.add(new Hashtable(lhtColRelationDetail));
       lhtColRelationDetail.clear();

       lhtColRelationDetail.put(dataView.STR_FIELD_NAME,"DD_NO");
       lhtColRelationDetail.put(dataView.STR_FIELD_TITLE,"'輔助設定'");
       lhtColRelationDetail.put(dataView.STR_FIELD_KIND,"INPUT");
       lhtColRelationDetail.put(dataView.STR_FIELD_PROPERTY,"WIDTH='10%' align='center'");
       lhtColRelationDetail.put(dataView.STR_FIELD_HTML,"<input type='text' size='20' maxlength='40' name='dd_no' value=");
       lhtColRelationDetail.put(dataView.STR_FIELD_APPEND_ROW_HTML,"<input type='text' size='20' maxlength='40' name='dd_no' value='DD_NO'/>");
       lhtColRelationDetail.put(dataView.STR_FIELD_VALUE,"DD_NO");


       laltColRelation.add(new Hashtable(lhtColRelationDetail));
       lhtColRelationDetail.clear();

       lhtColRelationDetail.put(dataView.STR_FIELD_NAME,"DD_DATA");
       lhtColRelationDetail.put(dataView.STR_FIELD_TITLE,"'參數設定'");
       lhtColRelationDetail.put(dataView.STR_FIELD_KIND,"INPUT");
       lhtColRelationDetail.put(dataView.STR_FIELD_PROPERTY,"WIDTH='10%' align='center'");
       lhtColRelationDetail.put(dataView.STR_FIELD_HTML,"<input type='text' size='20' maxlength='40' name='dd_data' value=");
       lhtColRelationDetail.put(dataView.STR_FIELD_APPEND_ROW_HTML,"<input type='text' size='20' maxlength='40' name='dd_data' value='DD_DATA'/>");
       lhtColRelationDetail.put(dataView.STR_FIELD_VALUE,"DD_DATA");

       laltColRelation.add(new Hashtable(lhtColRelationDetail));
       lhtColRelationDetail.clear();

       lhtColRelationDetail.put(dataView.STR_FIELD_NAME,"LOG_YN");
       lhtColRelationDetail.put(dataView.STR_FIELD_TITLE,"'Log'");
       lhtColRelationDetail.put(dataView.STR_FIELD_KIND,"INPUT");
       lhtColRelationDetail.put(dataView.STR_FIELD_PROPERTY,"WIDTH='10%' align='center'");
       lhtColRelationDetail.put(dataView.STR_FIELD_HTML,"<input type='text' size='20' maxlength='40' name='log_yn' value=");
       lhtColRelationDetail.put(dataView.STR_FIELD_APPEND_ROW_HTML,"<input type='text' size='20' maxlength='40' name='log_yn' value='LOG_YN'/>");
       lhtColRelationDetail.put(dataView.STR_FIELD_VALUE,"LOG_YN");

       laltColRelation.add(new Hashtable(lhtColRelationDetail));
       lhtColRelationDetail.clear();

       lhtColRelationDetail.put(dataView.STR_FIELD_NAME,"READONLY_YN");
       lhtColRelationDetail.put(dataView.STR_FIELD_TITLE,"'欄位唯讀'");
       lhtColRelationDetail.put(dataView.STR_FIELD_KIND,"INPUT");
       lhtColRelationDetail.put(dataView.STR_FIELD_PROPERTY,"WIDTH='10%' align='center'");
       lhtColRelationDetail.put(dataView.STR_FIELD_HTML,"<input type='text' size='20' maxlength='40' name='readonly_yn' value=");
       lhtColRelationDetail.put(dataView.STR_FIELD_APPEND_ROW_HTML,"<input type='text' size='20' maxlength='40' name='readonly_yn' value='READONLY_YN'/>");
       lhtColRelationDetail.put(dataView.STR_FIELD_VALUE,"READONLY_YN");

       laltColRelation.add(new Hashtable(lhtColRelationDetail));
       lhtColRelationDetail.clear();

       lhtColRelationDetail.put(dataView.STR_FIELD_NAME,"PROTECT_CNDT");
       lhtColRelationDetail.put(dataView.STR_FIELD_TITLE,"'唯讀條件'");
       lhtColRelationDetail.put(dataView.STR_FIELD_KIND,"INPUT");
       lhtColRelationDetail.put(dataView.STR_FIELD_PROPERTY,"WIDTH='10%' align='center'");
       lhtColRelationDetail.put(dataView.STR_FIELD_HTML,"<input type='text' size='20' maxlength='40' name='protect_cndt' value=");
       lhtColRelationDetail.put(dataView.STR_FIELD_APPEND_ROW_HTML,"<input type='text' size='20' maxlength='40' name='protect_cndt' value='PROTECT_CNDT'/>");
       lhtColRelationDetail.put(dataView.STR_FIELD_VALUE,"PROTECT_CNDT");
       lhtColRelationDetail.put(dataView.STR_FIELD_LINE_FEED,"true");

       laltColRelation.add(new Hashtable(lhtColRelationDetail));
       lhtColRelationDetail.clear();

       lhtColRelationDetail.put(dataView.STR_FIELD_NAME,"FLD_TITLE_C");
       lhtColRelationDetail.put(dataView.STR_FIELD_TITLE,"'中文名稱'");
       lhtColRelationDetail.put(dataView.STR_FIELD_KIND,"INPUT");
       lhtColRelationDetail.put(dataView.STR_FIELD_PROPERTY,"WIDTH='10%' align='center'");
       lhtColRelationDetail.put(dataView.STR_FIELD_HTML,"<input type='text' size='20' maxlength='40' name='fld_title_c' value=");
       lhtColRelationDetail.put(dataView.STR_FIELD_APPEND_ROW_HTML,"<input type='text' size='20' maxlength='40' name='fld_title_c' value='FLD_TITLE_C'/>");
       lhtColRelationDetail.put(dataView.STR_FIELD_VALUE,"FLD_TITLE_C");

       laltColRelation.add(new Hashtable(lhtColRelationDetail));
       lhtColRelationDetail.clear();

       lhtColRelationDetail.put(dataView.STR_FIELD_NAME,"FLD_TITLE_E");
       lhtColRelationDetail.put(dataView.STR_FIELD_TITLE,"'英文名稱'");
       lhtColRelationDetail.put(dataView.STR_FIELD_KIND,"INPUT");
       lhtColRelationDetail.put(dataView.STR_FIELD_PROPERTY,"WIDTH='10%' align='center'");
       lhtColRelationDetail.put(dataView.STR_FIELD_HTML,"<input type='text' size='20' maxlength='40' name='fld_title_e' value=");
       lhtColRelationDetail.put(dataView.STR_FIELD_APPEND_ROW_HTML,"<input type='text' size='20' maxlength='40' name='fld_title_e' value='FLD_TITLE_E'/>");
       lhtColRelationDetail.put(dataView.STR_FIELD_VALUE,"FLD_TITLE_E");

       laltColRelation.add(new Hashtable(lhtColRelationDetail));
       lhtColRelationDetail.clear();

       lhtColRelationDetail.put(dataView.STR_FIELD_NAME,"INIT_VALUE");
       lhtColRelationDetail.put(dataView.STR_FIELD_TITLE,"'欄位初始設定'");
       lhtColRelationDetail.put(dataView.STR_FIELD_KIND,"INPUT");
       lhtColRelationDetail.put(dataView.STR_FIELD_PROPERTY,"colSpan='3' WIDTH='10%' align='center'");
       lhtColRelationDetail.put(dataView.STR_FIELD_HTML,"<input type='text' size='77' maxlength='40' name='init_value' value=");
       lhtColRelationDetail.put(dataView.STR_FIELD_APPEND_ROW_HTML,"<input type='text' size='77' maxlength='40' name='init_value' value='INIT_VALUE'/>");
       lhtColRelationDetail.put(dataView.STR_FIELD_VALUE,"INIT_VALUE");

       laltColRelation.add(new Hashtable(lhtColRelationDetail));
       lhtColRelationDetail.clear();

       lhtColRelationDetail.put(dataView.STR_FIELD_NAME,"FLD_HIDDEN_YN");
       lhtColRelationDetail.put(dataView.STR_FIELD_TITLE,"'欄位隱藏'");
       lhtColRelationDetail.put(dataView.STR_FIELD_KIND,"INPUT");
       lhtColRelationDetail.put(dataView.STR_FIELD_PROPERTY,"WIDTH='10%' align='center'");
       lhtColRelationDetail.put(dataView.STR_FIELD_HTML,"<input type='text' size='20' maxlength='40' name='fld_hidden_yn' value=");
       lhtColRelationDetail.put(dataView.STR_FIELD_APPEND_ROW_HTML,"<input type='text' size='20' maxlength='40' name='fld_hidden_yn' value='FLD_HIDDEN_YN'/>");
       lhtColRelationDetail.put(dataView.STR_FIELD_VALUE,"FLD_HIDDEN_YN");

       laltColRelation.add(new Hashtable(lhtColRelationDetail));
       lhtColRelationDetail.clear();

       lhtColRelationDetail.put(dataView.STR_FIELD_NAME,"FLD_HIDDEN_CNDT");
       lhtColRelationDetail.put(dataView.STR_FIELD_TITLE,"'隱藏條件'");
       lhtColRelationDetail.put(dataView.STR_FIELD_KIND,"INPUT");
       lhtColRelationDetail.put(dataView.STR_FIELD_PROPERTY,"WIDTH='10%' align='center'");
       lhtColRelationDetail.put(dataView.STR_FIELD_HTML,"<input type='text' size='20' maxlength='40' name='fld_hidden_cndt' value=");
       lhtColRelationDetail.put(dataView.STR_FIELD_APPEND_ROW_HTML,"<input type='text' size='20' maxlength='40' name='fld_hidden_cndt' value='FLD_HIDDEN_CNDT'>");
       lhtColRelationDetail.put(dataView.STR_FIELD_VALUE,"FLD_HIDDEN_CNDT");

       laltColRelation.add(new Hashtable(lhtColRelationDetail));
       lhtColRelationDetail.clear();

       DataViewForm.setColRelationUseArrayList(laltColRelation);//將欄位相關設定殖入ActionForm
       DataViewForm.setJumpPageButtonShow(false);   //是否要秀出上下頁按鈕
       DataViewForm.setPageBtnOnTop(false);         //將button and rows info 秀在頂端
       DataViewForm.setPageBtnOnButtom(true);      //將button and rows info 秀在底端
       DataViewForm.setFilterShow(false);           //是否要秀出過濾選擇欄位
       DataViewForm.setJumpPageShow(false);         //是否要秀出跳頁下拉式選單
       DataViewForm.setRowsInfoShow(false);         //是否要秀出筆數資訊
       DataViewForm.setRowPageShow(false);          //是否要秀出每頁筆數控制欄
       DataViewForm.setExcelShow(false);           //是否要秀出轉Excel button
       DataViewForm.setOrderEnable(false);          //是否要提供排序點選功能
       DataViewForm.setShowHeaderWhenNoData(true);//當ResultSet無資料是否要秀Header
       DataViewForm.setAddNewShow(true);          //是否秀出新增鈕


       DataViewForm.setTableHeaderHtml("class='td_head_grid' align='center'  width='680px'");
             //設定上一頁與下一頁按鈕的form action(通常為母頁即本頁)
       DataViewForm.setPageActionURI(stbPageActionURI.toString());
       String strResult="";
       try{
         strResult=dataView.getOutputDataView(DataViewForm);
       }
       catch(Exception e){
         e.printStackTrace();
       }
       finally{
         try{
           gqbnDAO.close();
           gqbnDAO=null;
         }
         catch(Exception e){
           e.printStackTrace();
         }
       }

%>
<title>Insert title here</title>
<LINK HREF="/PUBPAGE/general/workflow.css" REL="STYLESHEET" TYPE="TEXT/CSS"/>
</head>
<body>
<input type="button" value="submit" onclick="javascript:document.forms['DataViewForm'].submit();"/>
<%=strResult%>
</body>
</html>
